<?php 
	$command_file = "command.txt";
	$screen_file = "screen.txt";
	
	$command = $_POST["cmd"];
	switch( $command ){
		case "CLICK":
		case "DOUBLE_CLICK":
		case "RIGHT_CLICK":
		case "CENTER_CLICK":
			$x = $_POST["x"];
			$y = $_POST["y"];
			file_put_contents($command_file, "COMMAND\r\n$command\r\n$x\r\n$y");
		break;
		
		case "CAPTURE":
			file_put_contents($command_file, "COMMAND\r\n$command");
			unlink("screen.jpg");
		break;
		
		case "TYPE":
			$content = $_POST["content"];
			$x = $_POST["x"];
			$y = $_POST["y"];
			file_put_contents($command_file, "COMMAND\r\n$command\r\n$x\r\n$y\r\n$content");
		break;
	}
;?>